package com.yijiu.response;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.yijiu.network.Response;
import com.yijiu.resource.MoneyIn;

public class MoneyInResponse extends Response {

	public List<MoneyIn> moneyInList;

	@Override
	protected void jsonToObject() {
		moneyInList = new ArrayList<MoneyIn>();
		try {
			JSONObject data = reposonJson.getJSONObject("result");
			JSONArray array = data.getJSONArray("infos");
			int size = array.length();
			for (int i = 0; i < size; i++) {
				JSONObject object = array.getJSONObject(i);
				MoneyIn moneyIn = new MoneyIn();
				moneyIn.payTime = object.optLong("payTime");
				moneyIn.outBizNo = object.optString("outBizNo");
				moneyIn.amount = object.optDouble("amount");
				moneyIn.bankName = object.optString("bankName");
				moneyIn.status = object.optString("status");
				moneyIn.apiAccess = object.optString("apiAccess");
				moneyInList.add(moneyIn);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

}